<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>店铺列表</title>
	<% include  ../template/commonCss.ejs %>
	<link href="<%=resUrl%>/css/shop/index.css" rel="stylesheet" type="text/css" />
	<% include ../template/commonJs.ejs %>
	<% include ../template/chatLister.ejs %>
</head>

<body ontouchstart>
	<div class="weui-flex">
		<div class="weui-flex__item">
			<div class="placeholder">
				<text>最新加入</text><i class="iconfont icon-tri-down-mini"></i>
			</div>
			<div class="children">
				<div class="item current" orderType="1">
					<text>最新加入</text><i class="iconfont icon-dagoux"></i>
				</div>
				<div class="item" orderType="2">
					<text>热度排序</text><i class="iconfont icon-dagoux"></i>
				</div>
			</div>
		</div>
		<div class="weui-flex__item" orderType="4">
			<div class="placeholder"><text>信用排序</text></div>
		</div>
		<div class="weui-flex__item" orderType="5">
			<div class="placeholder"><text>消保</text></div>
		</div>
		<div class="weui-flex__item last" id="screen">
			<div class="placeholder">
				<text>筛选</text><i class="iconfont icon-shaixuan"></i>
			</div>
		</div>
	</div>
	<div id="shopWrap">
		<!--下拉刷新-->
		<div class="weui-pull-to-refresh__layer" style="padding: 5px;">
			<div class="weui-pull-to-refresh__arrow"></div>
			<div class="weui-pull-to-refresh__preloader"></div>
			<div class="down">下拉刷新</div>
			<div class="up">释放刷新</div>
			<div class="refresh">正在刷新</div>
		</div>
		<div id="shoplist-content" class="weui-tab__bd-item weui-tab__bd-item--active">
		</div>
		<script id="shoplist" type="text/html">
			{{each list}}
				<div class="shoplist-item">
					<a class="shoplist-item-top" href="javascript:visitUrl('/shop/detail?id={{$value.id}}',true)" >   
						<div class="shoplist-item-logo" style="background: url({{$value.image}}?x-oss-process=image/resize,w_100) no-repeat 0 center;background-size: 100% auto;"></div>
						<span>{{$value.name}}</span>
						{{if $value.personalAuthentication>0}}<div class="cdetail-top-auth cdetail-top-orange"><i class="iconfont icon-credentials_icon"></i>身份认证</div>{{/if}}
						{{if $value.mobileAuthentication>0}}<div class="cdetail-top-auth cdetail-top-green"><i class="iconfont icon-shouji"></i>手机认证</div>{{/if}}
						{{if $value.marginAuthentication>0}}<div class="cdetail-top-auth cdetail-top-brightred"><i class="iconfont icon-baozhengjin"></i>消保500</div>{{/if}}
					</a>
					<div class="shoplist-item-body">
						{{each $value.productList as product i}}
							<a class="info" {{if product.type==1}} href="javascript:visitUrl('/auctionCollectDetail?id={{product.id}}',true)" {{else}} href="javascript:visitUrl('/collectDetail?id={{product.id}}',true)" {{/if}}>
								<div class="pic" style="background: url({{product.coverImage}}?x-oss-process=image/resize,w_500) no-repeat 0 center;background-size: 100% auto;"></div>
								<div class="title">{{product.name}}</div>
								<div class="price">
									<span>¥{{product.nowPrice}}</span>
									{{if product.type==1}}
										<i class="iconfont icon-paimai"></i>
									{{/if}}
								</div>
							</a>
						{{/each}}
					</div>
				</div>
			{{/each}}
			<div class="auto-height"></div>
		</script>
		<div class="weui-loadmore" id="loadmore">
			<i class="weui-loading"></i>
			<span class="weui-loadmore__tips">正在加载</span>
		</div>
		<div class="weui-loadmore weui-loadmore_line" style="display:none;" id="nomore">
			<span class="weui-loadmore__tips">到底了</span>
		</div>
		<script>
			$.post('/antique/api/sysDict/query_list', {
				token: getCookie('token'),
				type: 'firstcategory',
				parentId: '0'
			}, function (result) {
				var html = template('cate-list', result.data);
				document.getElementById('cate-list-content').innerHTML = html;
			});
		</script>
	</div>
	<div class="mask"></div>
	<div class="screen_condition" id="screen_condition">
		<div class="content">
			<div class="item">
				<div class="title">搜索关键字</div>
				<div class="list"><input type="text" name="keyword"/></div>
			</div>
			<div class="item">
				<div class="title">选择主营行业</div>
				<div class="list" id="cate-list-content">
				</div>
				<script id="cate-list" type="text/html">
					<div class="unit" value="">全部</div>
					{{each list}}
						<div class="unit" value="{{$value.id}}">{{$value.label}}</div>
					{{/each}}
					<div class="auto-height"></div>
				</script>	
				<script>
					var cate1 = '';
					var attrs = [];
					$.post('/antique/api/sysDict/query_list',{
						token:getCookie('token'),
						type:'firstcategory',
						parentId:'0'
					},function(result){
						var html = template('cate-list', result.data);
						document.getElementById('cate-list-content').innerHTML = html;
						function bindAllUnit(){
							$('.screen_condition .item .list .unit').unbind('click').bind('click',function(){
								bindCurrentUnit(this);
								var parentId = $(this).attr('value');
								cate1 = parentId;
							});
						}
						function bindCurrentUnit(_this){
							$('.screen_condition .item .list .unit').removeClass('current').unbind('click').hide();
							$(_this).addClass('current').show().click(function(){
								$('.screen_condition .item .list .unit').show();
								$(_this).removeClass('current');
								cate1 = '';
								bindAllUnit();
								$('#attrs').empty();
								resetCate();
							});
						}
						bindAllUnit();						
						$('#screen_condition_reset').click(function(){
							$('.screen_condition .item .list input').val('');
							$('.screen_condition .item .list .unit').removeClass('current');
						});
					});
				
					function resetCate(){
						cate1 = '';
						attrs = [];
					}
				</script>
			</div>
		</div>
		<div class="op">
			<button class="l" id="screen_condition_reset">重置</button>
			<button class="r" id="screen_condition_confirm">确认</button>
		</div>
	</div>
	<% var tabbarName = "shop"; %>
	<% include ../template/tabbar.ejs %>
	<script type="text/javascript" src="<%=resUrl%>/js/shop/index.js"></script>
</body>

</html>